package security;

public class SecurityFactory {

	private static SecurityFactory Instance ;
	private  Security currentSec ;
	private BlowfishSecurity blowfishSec;
	private RSASecurity rsaSec;
	private DESSecurity desSec;
	
	public static synchronized SecurityFactory getInstance(){
		if (Instance == null) {
			Instance = new SecurityFactory();
		}
		return Instance;
	}
	
	
	public Security getBlowfishSecurity() {
		if ( blowfishSec == null) {
			blowfishSec = new BlowfishSecurity();
		}
		currentSec = blowfishSec;
		return currentSec;
	} 
	
	public Security getRSASecurity() {
		if ( rsaSec == null) {
			rsaSec = new RSASecurity();
		}
		currentSec = rsaSec;
		return currentSec;
	} 
	
	public Security getDESSecurity() {
		if ( desSec == null) {
			desSec = new DESSecurity();
		}
		currentSec = desSec;
		return currentSec;
	} 
	
	public Security getCurrentSecurity() {
		if ( currentSec == null) {
			currentSec = new BlowfishSecurity();
		}
		return currentSec;
	} 
}
